/**
 * @author LKQ
 * @date 2022/2/23 12:18
 * @description
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int countPairs(int[] nums, int k) {
        int sum = 0, n = nums.length;
        for (int i = 0; i < n; i++) {
            for (int j = i+1; j < n; j++) {
                if (nums[i] == nums[j] && i * j % k == 0) {
                    sum++;
                }
            }
        }
        return sum;
    }
}
